package com.xiaobo.androidaidl;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;

import androidx.annotation.Nullable;

import com.xiaobo.androidaidl.IUserAidlInterface;

public class UserService extends Service {

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return new UserAidl();

    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.i("grage","onStartCommand");
        return super.onStartCommand(intent, flags, startId);
    }

    static class UserAidl extends IUserAidlInterface.Stub{

        @Override
        public void printUser(String name) throws RemoteException {
            Log.i("grage","printUser");
        }

        @Override
        public com.xiaobo.androidaidl.User getUser() throws RemoteException {
            return new User("张三");
        }
    }

}
